package com.infotel.cartegrise.ihm;

import java.awt.Component;

import javax.swing.DefaultListCellRenderer;
import javax.swing.JLabel;
import javax.swing.JList;

import com.infotel.prefecture.model.Modele;

public class ModeleListRenderer extends DefaultListCellRenderer {

    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    @Override
    public Component getListCellRendererComponent(JList<?> list, Object value,
            int index, boolean isSelected, boolean cellHasFocus) {
        if (value != null) {
            Modele m = (Modele) value;
            Component c = super.getListCellRendererComponent(list,
                    m.getDesignation(), m.getMarque().getId(), isSelected,
                    cellHasFocus);
            return c;
        }
   
        return new JLabel();
    }
}
